package boss.portal.entity.logg;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
@Document(indexName = "user_logger", type = "docs", shards = 1, replicas = 0)
public class UserOptLoggerEntity {

    @Id
    private String id;
    @Field(type = FieldType.Keyword)
    private String firmId;
    @Field(type = FieldType.Keyword)
    private String operator;
    @Field(type = FieldType.Keyword)
    private String optModule;

    @Field(type = FieldType.Date, format = DateFormat.date_optional_time)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone = "GMT+8")
//    @JSONField(format = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
    private Date optTime;
    @Field(type = FieldType.Keyword)
    private String optType;
    @Field(type = FieldType.Text)
    private String ip;
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String content;

}
